﻿<div class="span10">
	<h1>Responsável</h1>
	<?php echo Flash::render(); ?>
	<p>&nbsp;</p>
	<p>Nome: <strong><?php echo $responsavel->nome; ?></strong></p>
	<p>Telefone: <?php echo $responsavel->telefone; ?></p>
	<p>Email: <?php echo $responsavel->email; ?></p>
	<p>Setor: <?php echo $responsavel->setor; ?></p>
	
	<table class="table table-bordered">
	<thead>
		<tr>
			<th>Atividade</th>
			<th>Período</th>
		</tr>
	</thead>
	<tbody>
	<?php
	$reservas = $responsavel->reservas->find_all();
	
	foreach($reservas as $reserva):
	
		$periodos = $reserva->periodos
			->where('inicio', '>', strtotime('-1 Days'))
			->and_where('fim', '<=', strtotime('+7 Days'))
			->order_by(array('responsavel_id', 'inicio'))
			->find_all();
			
		foreach($periodos as $periodo):
		?>
		<tr>
			<td><?php echo Html::anchor('reserva/ver/'.$periodo->reserva->id, $periodo->reserva->atividade, array('title' => 'Dados da Reserva')); ?></td>
			<td>
				<p>Dia: <strong><?php echo date('d/m/Y', $periodo->inicio); ?></strong></p>
				<p>Horário: <strong><?php echo date('H:i', $periodo->inicio), 'h às ', date('H:i', $periodo->fim),'h'; ?></strong></p>
			</td>
		</tr>
		<?php
		endforeach;
	endforeach;
	?>
	</tbody>
	</table>
</div>